#pragma once
#include <iostream>
#include <string>
#include <vector>

const int not_a_reading = -7777;
const int not_a_month = -1;
const int implausible_min = -200;
const int implausible_max = 200;

struct Day
{
    std::vector<double> hour = std::vector<double>(24, not_a_reading);
};

struct Month
{
    int month = not_a_month;
    std::vector<Day> day{32};
};

struct Year
{
    int year;
    std::vector<Month> month{12};
};

struct Reading
{
    int day;
    int hour;
    double temperature;
};

std::istream &operator>>(std::istream &is, Reading &r);
std::istream &operator>>(std::istream &is, Month &m);
std::istream &operator>>(std::istream &is, Year &y);

int month_to_int(const std::string &s);
std::string int_to_month(int m);
bool is_valid(const Reading &r);
void end_of_loop(std::istream &ist, char terminator, const std::string &message);

std::ostream &operator<<(std::ostream &os, const Reading &r);
std::ostream &operator<<(std::ostream &os, const Month &m);
std::ostream &operator<<(std::ostream &os, const Year &y);